source('plotsimul.R')

losses <- -PlotGastos (100, 500, 20, 300)

hist(losses,
	right=FALSE, freq=FALSE, main='',
	xlab='Perdas', ylab='Frequência', border=rgb(1,0,1,.65), lwd=2, col=rgb(1,0,1,.05))


#runs <- length(losses)

#alpha <- 0.95

#losses <- sort ( losses )
#j <- floor( alpha * runs )
#var <- losses [j]
#print(var)

#tail <- losses[losses >= var]
#print(mean(tail))



#> print(var)
#[1] 474.6772
#> print(mean(tail))
#[1] 551.968

